package com.gitee.wsl


import com.gitee.wsl.prop.Attributes
import com.gitee.wsl.prop.AttributesContainer
import com.gitee.wsl.scheduler.sample.CoroutineTaskScheduler
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob


object Lib: AttributesContainer {

    override val attributes: Attributes = Attributes()

    val applicationScope: CoroutineScope by lazy { CoroutineScope(SupervisorJob() + Dispatchers.Default) }

    val scope: CoroutineScope by lazy { CoroutineScope( Dispatchers.Default) }

    val appSchedler: CoroutineTaskScheduler by lazy{ CoroutineTaskScheduler(applicationScope)}
}

interface LibConfig

expect val Lib.ioDispatcher : CoroutineDispatcher

val Dispatchers.ioDispatcher get() = Lib.ioDispatcher
